package com.own.business.level.entity.dto;

import com.own.business.level.entity.bo.LevelUserBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * LevelUserDto
 *
 * @author chenxueli
 * @date 2022-07-25 10:13:00
 */
@Schema(title = "用户等级" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class LevelUserDto extends BaseDto<LevelUserBo> {

    @Schema(title = "用户id")
    private Long userId;

    @Schema(title = "经验")
    private Integer exp;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public LevelUserBo toBo(LevelUserBo entity) {
        if (entity == null) {
            entity = new LevelUserBo();
        }
        entity.setUserId(this.userId);
        entity.setExp(this.exp);
        return super.toBo(entity);
    }

}
